<?php


/**
 * Created by PhpStorm.
 * User: 72925
 * Date: 2018/11/26
 * Time: 13:48
 * order: 首页相关操作
 */


namespace app\index\controller;

use think\Controller;
use app\index\model\Contact;
use app\index\model\Ad;
use think\Cache;




class Index extends Controller
{

 	/*广告*/
 	public function advert()
 	{
 		
 		$con = Contact::get(1);
 		$res = $con ->toArray();
                $arr = array('phone' => $res['phone']);
                $dat = ['code' => 200, 'msg' => '返回数据成功', $arr];
                return json_encode($dat, TRUE);
 	}



 	/*客服*/
	public function contact()
 	{
 		$con = Contact::get(1);
 		
 		$res = $con ->toArray();
                $arr = array('weixin' => $res['xin'], 'phone' => $res['phone']);
                $dat = ['code' => 200, 'msg' => '返回数据成功', $arr];
                return json_encode($dat, TRUE);
 	}


 	public function lunbo(){
 		$con=Ad::column('ad');
            $dat = ['code' => 200, 'msg' => '返回数据成功', 'img' => $con];
            return json_encode($dat, TRUE);
 	}


}